
USE [EcomProduct]
GO
SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_Get_List procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_Get_List') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_Get_List
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Gets all records from the tblArticle table
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_Get_List

AS


				
				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
					
				SELECT @@ROWCOUNT
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetPaged procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetPaged') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetPaged
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Gets records from the tblArticle table passing page index and page count parameters
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetPaged
(

	@WhereClause varchar (2000)  ,

	@OrderBy varchar (2000)  ,

	@PageIndex int   ,

	@PageSize int   
)
AS


				
				BEGIN
				DECLARE @PageLowerBound int
				DECLARE @PageUpperBound int
				
				-- Set the page bounds
				SET @PageLowerBound = @PageSize * @PageIndex
				SET @PageUpperBound = @PageLowerBound + @PageSize

				-- Create a temp table to store the select results
				CREATE TABLE #PageIndex
				(
				    [IndexId] int IDENTITY (1, 1) NOT NULL,
				    [Id] bigint 
				)
				
				-- Insert into the temp table
				DECLARE @SQL AS nvarchar(4000)
				SET @SQL = 'INSERT INTO #PageIndex ([Id])'
				SET @SQL = @SQL + ' SELECT'
				IF @PageSize > 0
				BEGIN
					SET @SQL = @SQL + ' TOP ' + CONVERT(nvarchar, @PageUpperBound)
				END
				SET @SQL = @SQL + ' [Id]'
				SET @SQL = @SQL + ' FROM [dbo].[tblArticle]'
				IF LEN(@WhereClause) > 0
				BEGIN
					SET @SQL = @SQL + ' WHERE ' + @WhereClause
				END
				IF LEN(@OrderBy) > 0
				BEGIN
					SET @SQL = @SQL + ' ORDER BY ' + @OrderBy
				END
				
				-- Populate the temp table
				EXEC sp_executesql @SQL

				-- Return paged results
				SELECT O.[Id], O.[OriginalId], O.[Title], O.[Alias], O.[Intro], O.[MainContent], O.[LinkImage], O.[MenuId], O.[MenuTitle], O.[MenuAlias], O.[MenuLink], O.[Language], O.[IsDisabled], O.[IsRemoved], O.[DatePublish], O.[DateCreate], O.[UserCreate], O.[DateModify], O.[UserModify]
				FROM
				    [dbo].[tblArticle] O,
				    #PageIndex PageIndex
				WHERE
				    PageIndex.IndexId > @PageLowerBound
					AND O.[Id] = PageIndex.[Id]
				ORDER BY
				    PageIndex.IndexId
				
				-- get row count
				SET @SQL = 'SELECT COUNT(*) AS TotalRowCount'
				SET @SQL = @SQL + ' FROM [dbo].[tblArticle]'
				IF LEN(@WhereClause) > 0
				BEGIN
					SET @SQL = @SQL + ' WHERE ' + @WhereClause
				END
				EXEC sp_executesql @SQL
			
				END
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_Insert procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_Insert') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_Insert
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Inserts a record into the tblArticle table
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_Insert
(

	@Id bigint    OUTPUT,

	@OriginalId bigint   ,

	@Title nvarchar (200)  ,

	@Alias nvarchar (200)  ,

	@Intro nvarchar (1000)  ,

	@MainContent ntext   ,

	@LinkImage nvarchar (200)  ,

	@MenuId bigint   ,

	@MenuTitle nvarchar (200)  ,

	@MenuAlias nvarchar (200)  ,

	@MenuLink nvarchar (200)  ,

	@Language nvarchar (20)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   ,

	@DatePublish datetime   ,

	@DateCreate datetime   ,

	@UserCreate nvarchar (200)  ,

	@DateModify datetime   ,

	@UserModify nvarchar (200)  
)
AS


				
				INSERT INTO [dbo].[tblArticle]
					(
					[OriginalId]
					,[Title]
					,[Alias]
					,[Intro]
					,[MainContent]
					,[LinkImage]
					,[MenuId]
					,[MenuTitle]
					,[MenuAlias]
					,[MenuLink]
					,[Language]
					,[IsDisabled]
					,[IsRemoved]
					,[DatePublish]
					,[DateCreate]
					,[UserCreate]
					,[DateModify]
					,[UserModify]
					)
				VALUES
					(
					@OriginalId
					,@Title
					,@Alias
					,@Intro
					,@MainContent
					,@LinkImage
					,@MenuId
					,@MenuTitle
					,@MenuAlias
					,@MenuLink
					,@Language
					,@IsDisabled
					,@IsRemoved
					,@DatePublish
					,@DateCreate
					,@UserCreate
					,@DateModify
					,@UserModify
					)
				
				-- Get the identity value
				SET @Id = SCOPE_IDENTITY()
									
							
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_Update procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_Update') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_Update
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Updates a record in the tblArticle table
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_Update
(

	@Id bigint   ,

	@OriginalId bigint   ,

	@Title nvarchar (200)  ,

	@Alias nvarchar (200)  ,

	@Intro nvarchar (1000)  ,

	@MainContent ntext   ,

	@LinkImage nvarchar (200)  ,

	@MenuId bigint   ,

	@MenuTitle nvarchar (200)  ,

	@MenuAlias nvarchar (200)  ,

	@MenuLink nvarchar (200)  ,

	@Language nvarchar (20)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   ,

	@DatePublish datetime   ,

	@DateCreate datetime   ,

	@UserCreate nvarchar (200)  ,

	@DateModify datetime   ,

	@UserModify nvarchar (200)  
)
AS


				
				
				-- Modify the updatable columns
				UPDATE
					[dbo].[tblArticle]
				SET
					[OriginalId] = @OriginalId
					,[Title] = @Title
					,[Alias] = @Alias
					,[Intro] = @Intro
					,[MainContent] = @MainContent
					,[LinkImage] = @LinkImage
					,[MenuId] = @MenuId
					,[MenuTitle] = @MenuTitle
					,[MenuAlias] = @MenuAlias
					,[MenuLink] = @MenuLink
					,[Language] = @Language
					,[IsDisabled] = @IsDisabled
					,[IsRemoved] = @IsRemoved
					,[DatePublish] = @DatePublish
					,[DateCreate] = @DateCreate
					,[UserCreate] = @UserCreate
					,[DateModify] = @DateModify
					,[UserModify] = @UserModify
				WHERE
[Id] = @Id 
				
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_Delete procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_Delete') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_Delete
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Deletes a record in the tblArticle table
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_Delete
(

	@Id bigint   
)
AS


				DELETE FROM [dbo].[tblArticle] WITH (ROWLOCK) 
				WHERE
					[Id] = @Id
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByAlias procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByAlias') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByAlias
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByAlias
(

	@Alias nvarchar (200)  
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[Alias] = @Alias
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByAliasIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByAliasIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByAliasIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByAliasIsDisabled
(

	@Alias nvarchar (200)  ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[Alias] = @Alias
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByAliasIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByAliasIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByAliasIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByAliasIsDisabledIsRemoved
(

	@Alias nvarchar (200)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[Alias] = @Alias
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByAliasIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByAliasIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByAliasIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByAliasIsRemoved
(

	@Alias nvarchar (200)  ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[Alias] = @Alias
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByIdIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByIdIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByIdIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByIdIsDisabled
(

	@Id bigint   ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[Id] = @Id
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByIdIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByIdIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByIdIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByIdIsDisabledIsRemoved
(

	@Id bigint   ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[Id] = @Id
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByIdIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByIdIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByIdIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByIdIsRemoved
(

	@Id bigint   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[Id] = @Id
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByIdLanguage procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByIdLanguage') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByIdLanguage
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByIdLanguage
(

	@Id bigint   ,

	@Language nvarchar (20)  
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[Id] = @Id
					AND [Language] = @Language
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByIdLanguageIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByIdLanguageIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByIdLanguageIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByIdLanguageIsDisabled
(

	@Id bigint   ,

	@Language nvarchar (20)  ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[Id] = @Id
					AND [Language] = @Language
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByIdLanguageIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByIdLanguageIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByIdLanguageIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByIdLanguageIsDisabledIsRemoved
(

	@Id bigint   ,

	@Language nvarchar (20)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[Id] = @Id
					AND [Language] = @Language
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByIdLanguageIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByIdLanguageIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByIdLanguageIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByIdLanguageIsRemoved
(

	@Id bigint   ,

	@Language nvarchar (20)  ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[Id] = @Id
					AND [Language] = @Language
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByIdOriginalId procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByIdOriginalId') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByIdOriginalId
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByIdOriginalId
(

	@Id bigint   ,

	@OriginalId bigint   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[Id] = @Id
					AND [OriginalId] = @OriginalId
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByIdOriginalIdIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByIdOriginalIdIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByIdOriginalIdIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByIdOriginalIdIsDisabled
(

	@Id bigint   ,

	@OriginalId bigint   ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[Id] = @Id
					AND [OriginalId] = @OriginalId
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByIdOriginalIdIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByIdOriginalIdIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByIdOriginalIdIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByIdOriginalIdIsDisabledIsRemoved
(

	@Id bigint   ,

	@OriginalId bigint   ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[Id] = @Id
					AND [OriginalId] = @OriginalId
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByIdOriginalIdIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByIdOriginalIdIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByIdOriginalIdIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByIdOriginalIdIsRemoved
(

	@Id bigint   ,

	@OriginalId bigint   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[Id] = @Id
					AND [OriginalId] = @OriginalId
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByIsDisabled
(

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByIsDisabledIsRemoved
(

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByIsRemoved
(

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByLanguage procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByLanguage') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByLanguage
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByLanguage
(

	@Language nvarchar (20)  
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[Language] = @Language
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByLanguageIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByLanguageIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByLanguageIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByLanguageIsDisabled
(

	@Language nvarchar (20)  ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[Language] = @Language
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByLanguageIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByLanguageIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByLanguageIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByLanguageIsDisabledIsRemoved
(

	@Language nvarchar (20)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[Language] = @Language
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByLanguageIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByLanguageIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByLanguageIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByLanguageIsRemoved
(

	@Language nvarchar (20)  ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[Language] = @Language
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByOriginalId procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByOriginalId') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByOriginalId
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByOriginalId
(

	@OriginalId bigint   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[OriginalId] = @OriginalId
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByOriginalIdIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByOriginalIdIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByOriginalIdIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByOriginalIdIsDisabled
(

	@OriginalId bigint   ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[OriginalId] = @OriginalId
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByOriginalIdIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByOriginalIdIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByOriginalIdIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByOriginalIdIsDisabledIsRemoved
(

	@OriginalId bigint   ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[OriginalId] = @OriginalId
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByOriginalIdIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByOriginalIdIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByOriginalIdIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByOriginalIdIsRemoved
(

	@OriginalId bigint   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[OriginalId] = @OriginalId
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByOriginalIdLanguage procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByOriginalIdLanguage') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByOriginalIdLanguage
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByOriginalIdLanguage
(

	@OriginalId bigint   ,

	@Language nvarchar (20)  
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[OriginalId] = @OriginalId
					AND [Language] = @Language
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByOriginalIdLanguageIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByOriginalIdLanguageIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByOriginalIdLanguageIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByOriginalIdLanguageIsDisabled
(

	@OriginalId bigint   ,

	@Language nvarchar (20)  ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[OriginalId] = @OriginalId
					AND [Language] = @Language
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByOriginalIdLanguageIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByOriginalIdLanguageIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByOriginalIdLanguageIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByOriginalIdLanguageIsDisabledIsRemoved
(

	@OriginalId bigint   ,

	@Language nvarchar (20)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[OriginalId] = @OriginalId
					AND [Language] = @Language
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetByOriginalIdLanguageIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetByOriginalIdLanguageIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetByOriginalIdLanguageIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetByOriginalIdLanguageIsRemoved
(

	@OriginalId bigint   ,

	@Language nvarchar (20)  ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[OriginalId] = @OriginalId
					AND [Language] = @Language
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_GetById procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_GetById') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_GetById
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblArticle table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_GetById
(

	@Id bigint   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[Intro],
					[MainContent],
					[LinkImage],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DatePublish],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblArticle]
				WHERE
					[Id] = @Id
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblArticle_Find procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblArticle_Find') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblArticle_Find
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Finds records in the tblArticle table passing nullable parameters
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblArticle_Find
(

	@SearchUsingOR bit   = null ,

	@Id bigint   = null ,

	@OriginalId bigint   = null ,

	@Title nvarchar (200)  = null ,

	@Alias nvarchar (200)  = null ,

	@Intro nvarchar (1000)  = null ,

	@MainContent ntext   = null ,

	@LinkImage nvarchar (200)  = null ,

	@MenuId bigint   = null ,

	@MenuTitle nvarchar (200)  = null ,

	@MenuAlias nvarchar (200)  = null ,

	@MenuLink nvarchar (200)  = null ,

	@Language nvarchar (20)  = null ,

	@IsDisabled bit   = null ,

	@IsRemoved bit   = null ,

	@DatePublish datetime   = null ,

	@DateCreate datetime   = null ,

	@UserCreate nvarchar (200)  = null ,

	@DateModify datetime   = null ,

	@UserModify nvarchar (200)  = null 
)
AS


				
  IF ISNULL(@SearchUsingOR, 0) <> 1
  BEGIN
    SELECT
	  [Id]
	, [OriginalId]
	, [Title]
	, [Alias]
	, [Intro]
	, [MainContent]
	, [LinkImage]
	, [MenuId]
	, [MenuTitle]
	, [MenuAlias]
	, [MenuLink]
	, [Language]
	, [IsDisabled]
	, [IsRemoved]
	, [DatePublish]
	, [DateCreate]
	, [UserCreate]
	, [DateModify]
	, [UserModify]
    FROM
	[dbo].[tblArticle]
    WHERE 
	 ([Id] = @Id OR @Id IS NULL)
	AND ([OriginalId] = @OriginalId OR @OriginalId IS NULL)
	AND ([Title] = @Title OR @Title IS NULL)
	AND ([Alias] = @Alias OR @Alias IS NULL)
	AND ([Intro] = @Intro OR @Intro IS NULL)
	AND ([LinkImage] = @LinkImage OR @LinkImage IS NULL)
	AND ([MenuId] = @MenuId OR @MenuId IS NULL)
	AND ([MenuTitle] = @MenuTitle OR @MenuTitle IS NULL)
	AND ([MenuAlias] = @MenuAlias OR @MenuAlias IS NULL)
	AND ([MenuLink] = @MenuLink OR @MenuLink IS NULL)
	AND ([Language] = @Language OR @Language IS NULL)
	AND ([IsDisabled] = @IsDisabled OR @IsDisabled IS NULL)
	AND ([IsRemoved] = @IsRemoved OR @IsRemoved IS NULL)
	AND ([DatePublish] = @DatePublish OR @DatePublish IS NULL)
	AND ([DateCreate] = @DateCreate OR @DateCreate IS NULL)
	AND ([UserCreate] = @UserCreate OR @UserCreate IS NULL)
	AND ([DateModify] = @DateModify OR @DateModify IS NULL)
	AND ([UserModify] = @UserModify OR @UserModify IS NULL)
						
  END
  ELSE
  BEGIN
    SELECT
	  [Id]
	, [OriginalId]
	, [Title]
	, [Alias]
	, [Intro]
	, [MainContent]
	, [LinkImage]
	, [MenuId]
	, [MenuTitle]
	, [MenuAlias]
	, [MenuLink]
	, [Language]
	, [IsDisabled]
	, [IsRemoved]
	, [DatePublish]
	, [DateCreate]
	, [UserCreate]
	, [DateModify]
	, [UserModify]
    FROM
	[dbo].[tblArticle]
    WHERE 
	 ([Id] = @Id AND @Id is not null)
	OR ([OriginalId] = @OriginalId AND @OriginalId is not null)
	OR ([Title] = @Title AND @Title is not null)
	OR ([Alias] = @Alias AND @Alias is not null)
	OR ([Intro] = @Intro AND @Intro is not null)
	OR ([LinkImage] = @LinkImage AND @LinkImage is not null)
	OR ([MenuId] = @MenuId AND @MenuId is not null)
	OR ([MenuTitle] = @MenuTitle AND @MenuTitle is not null)
	OR ([MenuAlias] = @MenuAlias AND @MenuAlias is not null)
	OR ([MenuLink] = @MenuLink AND @MenuLink is not null)
	OR ([Language] = @Language AND @Language is not null)
	OR ([IsDisabled] = @IsDisabled AND @IsDisabled is not null)
	OR ([IsRemoved] = @IsRemoved AND @IsRemoved is not null)
	OR ([DatePublish] = @DatePublish AND @DatePublish is not null)
	OR ([DateCreate] = @DateCreate AND @DateCreate is not null)
	OR ([UserCreate] = @UserCreate AND @UserCreate is not null)
	OR ([DateModify] = @DateModify AND @DateModify is not null)
	OR ([UserModify] = @UserModify AND @UserModify is not null)
	SELECT @@ROWCOUNT			
  END
				

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_Get_List procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_Get_List') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_Get_List
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Gets all records from the tblProduct table
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_Get_List

AS


				
				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
					
				SELECT @@ROWCOUNT
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetPaged procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetPaged') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetPaged
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Gets records from the tblProduct table passing page index and page count parameters
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetPaged
(

	@WhereClause varchar (2000)  ,

	@OrderBy varchar (2000)  ,

	@PageIndex int   ,

	@PageSize int   
)
AS


				
				BEGIN
				DECLARE @PageLowerBound int
				DECLARE @PageUpperBound int
				
				-- Set the page bounds
				SET @PageLowerBound = @PageSize * @PageIndex
				SET @PageUpperBound = @PageLowerBound + @PageSize

				-- Create a temp table to store the select results
				CREATE TABLE #PageIndex
				(
				    [IndexId] int IDENTITY (1, 1) NOT NULL,
				    [Id] bigint 
				)
				
				-- Insert into the temp table
				DECLARE @SQL AS nvarchar(4000)
				SET @SQL = 'INSERT INTO #PageIndex ([Id])'
				SET @SQL = @SQL + ' SELECT'
				IF @PageSize > 0
				BEGIN
					SET @SQL = @SQL + ' TOP ' + CONVERT(nvarchar, @PageUpperBound)
				END
				SET @SQL = @SQL + ' [Id]'
				SET @SQL = @SQL + ' FROM [dbo].[tblProduct]'
				IF LEN(@WhereClause) > 0
				BEGIN
					SET @SQL = @SQL + ' WHERE ' + @WhereClause
				END
				IF LEN(@OrderBy) > 0
				BEGIN
					SET @SQL = @SQL + ' ORDER BY ' + @OrderBy
				END
				
				-- Populate the temp table
				EXEC sp_executesql @SQL

				-- Return paged results
				SELECT O.[Id], O.[OriginalId], O.[Title], O.[Alias], O.[ProductCode], O.[Price], O.[Size], O.[Producer], O.[Store], O.[Promotion], O.[Maintenance], O.[Description], O.[MenuId], O.[MenuTitle], O.[MenuAlias], O.[MenuLink], O.[Language], O.[IsDisabled], O.[IsRemoved], O.[DateCreate], O.[UserCreate], O.[DateModify], O.[UserModify]
				FROM
				    [dbo].[tblProduct] O,
				    #PageIndex PageIndex
				WHERE
				    PageIndex.IndexId > @PageLowerBound
					AND O.[Id] = PageIndex.[Id]
				ORDER BY
				    PageIndex.IndexId
				
				-- get row count
				SET @SQL = 'SELECT COUNT(*) AS TotalRowCount'
				SET @SQL = @SQL + ' FROM [dbo].[tblProduct]'
				IF LEN(@WhereClause) > 0
				BEGIN
					SET @SQL = @SQL + ' WHERE ' + @WhereClause
				END
				EXEC sp_executesql @SQL
			
				END
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_Insert procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_Insert') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_Insert
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Inserts a record into the tblProduct table
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_Insert
(

	@Id bigint    OUTPUT,

	@OriginalId bigint   ,

	@Title nvarchar (200)  ,

	@Alias nvarchar (200)  ,

	@ProductCode nvarchar (50)  ,

	@Price nvarchar (50)  ,

	@Size nvarchar (50)  ,

	@Producer nvarchar (200)  ,

	@Store nvarchar (200)  ,

	@Promotion nvarchar (200)  ,

	@Maintenance nvarchar (200)  ,

	@Description ntext   ,

	@MenuId bigint   ,

	@MenuTitle nvarchar (200)  ,

	@MenuAlias nvarchar (200)  ,

	@MenuLink nvarchar (200)  ,

	@Language nvarchar (20)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   ,

	@DateCreate datetime   ,

	@UserCreate nvarchar (200)  ,

	@DateModify datetime   ,

	@UserModify nvarchar (200)  
)
AS


				
				INSERT INTO [dbo].[tblProduct]
					(
					[OriginalId]
					,[Title]
					,[Alias]
					,[ProductCode]
					,[Price]
					,[Size]
					,[Producer]
					,[Store]
					,[Promotion]
					,[Maintenance]
					,[Description]
					,[MenuId]
					,[MenuTitle]
					,[MenuAlias]
					,[MenuLink]
					,[Language]
					,[IsDisabled]
					,[IsRemoved]
					,[DateCreate]
					,[UserCreate]
					,[DateModify]
					,[UserModify]
					)
				VALUES
					(
					@OriginalId
					,@Title
					,@Alias
					,@ProductCode
					,@Price
					,@Size
					,@Producer
					,@Store
					,@Promotion
					,@Maintenance
					,@Description
					,@MenuId
					,@MenuTitle
					,@MenuAlias
					,@MenuLink
					,@Language
					,@IsDisabled
					,@IsRemoved
					,@DateCreate
					,@UserCreate
					,@DateModify
					,@UserModify
					)
				
				-- Get the identity value
				SET @Id = SCOPE_IDENTITY()
									
							
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_Update procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_Update') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_Update
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Updates a record in the tblProduct table
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_Update
(

	@Id bigint   ,

	@OriginalId bigint   ,

	@Title nvarchar (200)  ,

	@Alias nvarchar (200)  ,

	@ProductCode nvarchar (50)  ,

	@Price nvarchar (50)  ,

	@Size nvarchar (50)  ,

	@Producer nvarchar (200)  ,

	@Store nvarchar (200)  ,

	@Promotion nvarchar (200)  ,

	@Maintenance nvarchar (200)  ,

	@Description ntext   ,

	@MenuId bigint   ,

	@MenuTitle nvarchar (200)  ,

	@MenuAlias nvarchar (200)  ,

	@MenuLink nvarchar (200)  ,

	@Language nvarchar (20)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   ,

	@DateCreate datetime   ,

	@UserCreate nvarchar (200)  ,

	@DateModify datetime   ,

	@UserModify nvarchar (200)  
)
AS


				
				
				-- Modify the updatable columns
				UPDATE
					[dbo].[tblProduct]
				SET
					[OriginalId] = @OriginalId
					,[Title] = @Title
					,[Alias] = @Alias
					,[ProductCode] = @ProductCode
					,[Price] = @Price
					,[Size] = @Size
					,[Producer] = @Producer
					,[Store] = @Store
					,[Promotion] = @Promotion
					,[Maintenance] = @Maintenance
					,[Description] = @Description
					,[MenuId] = @MenuId
					,[MenuTitle] = @MenuTitle
					,[MenuAlias] = @MenuAlias
					,[MenuLink] = @MenuLink
					,[Language] = @Language
					,[IsDisabled] = @IsDisabled
					,[IsRemoved] = @IsRemoved
					,[DateCreate] = @DateCreate
					,[UserCreate] = @UserCreate
					,[DateModify] = @DateModify
					,[UserModify] = @UserModify
				WHERE
[Id] = @Id 
				
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_Delete procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_Delete') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_Delete
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Deletes a record in the tblProduct table
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_Delete
(

	@Id bigint   
)
AS


				DELETE FROM [dbo].[tblProduct] WITH (ROWLOCK) 
				WHERE
					[Id] = @Id
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByAlias procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByAlias') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByAlias
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByAlias
(

	@Alias nvarchar (200)  
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[Alias] = @Alias
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByAliasIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByAliasIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByAliasIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByAliasIsDisabled
(

	@Alias nvarchar (200)  ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[Alias] = @Alias
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByAliasIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByAliasIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByAliasIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByAliasIsDisabledIsRemoved
(

	@Alias nvarchar (200)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[Alias] = @Alias
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByAliasIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByAliasIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByAliasIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByAliasIsRemoved
(

	@Alias nvarchar (200)  ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[Alias] = @Alias
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByIdIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByIdIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByIdIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByIdIsDisabled
(

	@Id bigint   ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[Id] = @Id
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByIdIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByIdIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByIdIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByIdIsDisabledIsRemoved
(

	@Id bigint   ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[Id] = @Id
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByIdIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByIdIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByIdIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByIdIsRemoved
(

	@Id bigint   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[Id] = @Id
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByIdLanguage procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByIdLanguage') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByIdLanguage
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByIdLanguage
(

	@Id bigint   ,

	@Language nvarchar (20)  
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[Id] = @Id
					AND [Language] = @Language
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByIdLanguageIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByIdLanguageIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByIdLanguageIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByIdLanguageIsDisabled
(

	@Id bigint   ,

	@Language nvarchar (20)  ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[Id] = @Id
					AND [Language] = @Language
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByIdLanguageIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByIdLanguageIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByIdLanguageIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByIdLanguageIsDisabledIsRemoved
(

	@Id bigint   ,

	@Language nvarchar (20)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[Id] = @Id
					AND [Language] = @Language
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByIdLanguageIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByIdLanguageIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByIdLanguageIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByIdLanguageIsRemoved
(

	@Id bigint   ,

	@Language nvarchar (20)  ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[Id] = @Id
					AND [Language] = @Language
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByIdOriginalId procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByIdOriginalId') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByIdOriginalId
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByIdOriginalId
(

	@Id bigint   ,

	@OriginalId bigint   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[Id] = @Id
					AND [OriginalId] = @OriginalId
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByIdOriginalIdIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByIdOriginalIdIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByIdOriginalIdIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByIdOriginalIdIsDisabled
(

	@Id bigint   ,

	@OriginalId bigint   ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[Id] = @Id
					AND [OriginalId] = @OriginalId
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByIdOriginalIdIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByIdOriginalIdIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByIdOriginalIdIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByIdOriginalIdIsDisabledIsRemoved
(

	@Id bigint   ,

	@OriginalId bigint   ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[Id] = @Id
					AND [OriginalId] = @OriginalId
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByIdOriginalIdIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByIdOriginalIdIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByIdOriginalIdIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByIdOriginalIdIsRemoved
(

	@Id bigint   ,

	@OriginalId bigint   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[Id] = @Id
					AND [OriginalId] = @OriginalId
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByLanguage procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByLanguage') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByLanguage
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByLanguage
(

	@Language nvarchar (20)  
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[Language] = @Language
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByLanguageIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByLanguageIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByLanguageIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByLanguageIsDisabled
(

	@Language nvarchar (20)  ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[Language] = @Language
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByLanguageIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByLanguageIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByLanguageIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByLanguageIsDisabledIsRemoved
(

	@Language nvarchar (20)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[Language] = @Language
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByLanguageIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByLanguageIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByLanguageIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByLanguageIsRemoved
(

	@Language nvarchar (20)  ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[Language] = @Language
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByMenuAlias procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByMenuAlias') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByMenuAlias
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByMenuAlias
(

	@MenuAlias nvarchar (200)  
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[MenuAlias] = @MenuAlias
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByMenuAliasIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByMenuAliasIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByMenuAliasIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByMenuAliasIsDisabled
(

	@MenuAlias nvarchar (200)  ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[MenuAlias] = @MenuAlias
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByMenuAliasIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByMenuAliasIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByMenuAliasIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByMenuAliasIsDisabledIsRemoved
(

	@MenuAlias nvarchar (200)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[MenuAlias] = @MenuAlias
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByMenuAliasIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByMenuAliasIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByMenuAliasIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByMenuAliasIsRemoved
(

	@MenuAlias nvarchar (200)  ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[MenuAlias] = @MenuAlias
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByMenuId procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByMenuId') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByMenuId
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByMenuId
(

	@MenuId bigint   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[MenuId] = @MenuId
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByMenuIdIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByMenuIdIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByMenuIdIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByMenuIdIsDisabled
(

	@MenuId bigint   ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[MenuId] = @MenuId
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByMenuIdIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByMenuIdIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByMenuIdIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByMenuIdIsDisabledIsRemoved
(

	@MenuId bigint   ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[MenuId] = @MenuId
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByMenuIdIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByMenuIdIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByMenuIdIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByMenuIdIsRemoved
(

	@MenuId bigint   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[MenuId] = @MenuId
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByMenuIdLanguage procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByMenuIdLanguage') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByMenuIdLanguage
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByMenuIdLanguage
(

	@MenuId bigint   ,

	@Language nvarchar (20)  
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[MenuId] = @MenuId
					AND [Language] = @Language
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByMenuIdLanguageIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByMenuIdLanguageIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByMenuIdLanguageIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByMenuIdLanguageIsDisabled
(

	@MenuId bigint   ,

	@Language nvarchar (20)  ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[MenuId] = @MenuId
					AND [Language] = @Language
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByMenuIdLanguageIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByMenuIdLanguageIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByMenuIdLanguageIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByMenuIdLanguageIsDisabledIsRemoved
(

	@MenuId bigint   ,

	@Language nvarchar (20)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[MenuId] = @MenuId
					AND [Language] = @Language
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetByMenuIdLanguageIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetByMenuIdLanguageIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetByMenuIdLanguageIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetByMenuIdLanguageIsRemoved
(

	@MenuId bigint   ,

	@Language nvarchar (20)  ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[MenuId] = @MenuId
					AND [Language] = @Language
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_GetById procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_GetById') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_GetById
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblProduct table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_GetById
(

	@Id bigint   
)
AS


				SELECT
					[Id],
					[OriginalId],
					[Title],
					[Alias],
					[ProductCode],
					[Price],
					[Size],
					[Producer],
					[Store],
					[Promotion],
					[Maintenance],
					[Description],
					[MenuId],
					[MenuTitle],
					[MenuAlias],
					[MenuLink],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblProduct]
				WHERE
					[Id] = @Id
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblProduct_Find procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblProduct_Find') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblProduct_Find
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Finds records in the tblProduct table passing nullable parameters
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblProduct_Find
(

	@SearchUsingOR bit   = null ,

	@Id bigint   = null ,

	@OriginalId bigint   = null ,

	@Title nvarchar (200)  = null ,

	@Alias nvarchar (200)  = null ,

	@ProductCode nvarchar (50)  = null ,

	@Price nvarchar (50)  = null ,

	@Size nvarchar (50)  = null ,

	@Producer nvarchar (200)  = null ,

	@Store nvarchar (200)  = null ,

	@Promotion nvarchar (200)  = null ,

	@Maintenance nvarchar (200)  = null ,

	@Description ntext   = null ,

	@MenuId bigint   = null ,

	@MenuTitle nvarchar (200)  = null ,

	@MenuAlias nvarchar (200)  = null ,

	@MenuLink nvarchar (200)  = null ,

	@Language nvarchar (20)  = null ,

	@IsDisabled bit   = null ,

	@IsRemoved bit   = null ,

	@DateCreate datetime   = null ,

	@UserCreate nvarchar (200)  = null ,

	@DateModify datetime   = null ,

	@UserModify nvarchar (200)  = null 
)
AS


				
  IF ISNULL(@SearchUsingOR, 0) <> 1
  BEGIN
    SELECT
	  [Id]
	, [OriginalId]
	, [Title]
	, [Alias]
	, [ProductCode]
	, [Price]
	, [Size]
	, [Producer]
	, [Store]
	, [Promotion]
	, [Maintenance]
	, [Description]
	, [MenuId]
	, [MenuTitle]
	, [MenuAlias]
	, [MenuLink]
	, [Language]
	, [IsDisabled]
	, [IsRemoved]
	, [DateCreate]
	, [UserCreate]
	, [DateModify]
	, [UserModify]
    FROM
	[dbo].[tblProduct]
    WHERE 
	 ([Id] = @Id OR @Id IS NULL)
	AND ([OriginalId] = @OriginalId OR @OriginalId IS NULL)
	AND ([Title] = @Title OR @Title IS NULL)
	AND ([Alias] = @Alias OR @Alias IS NULL)
	AND ([ProductCode] = @ProductCode OR @ProductCode IS NULL)
	AND ([Price] = @Price OR @Price IS NULL)
	AND ([Size] = @Size OR @Size IS NULL)
	AND ([Producer] = @Producer OR @Producer IS NULL)
	AND ([Store] = @Store OR @Store IS NULL)
	AND ([Promotion] = @Promotion OR @Promotion IS NULL)
	AND ([Maintenance] = @Maintenance OR @Maintenance IS NULL)
	AND ([MenuId] = @MenuId OR @MenuId IS NULL)
	AND ([MenuTitle] = @MenuTitle OR @MenuTitle IS NULL)
	AND ([MenuAlias] = @MenuAlias OR @MenuAlias IS NULL)
	AND ([MenuLink] = @MenuLink OR @MenuLink IS NULL)
	AND ([Language] = @Language OR @Language IS NULL)
	AND ([IsDisabled] = @IsDisabled OR @IsDisabled IS NULL)
	AND ([IsRemoved] = @IsRemoved OR @IsRemoved IS NULL)
	AND ([DateCreate] = @DateCreate OR @DateCreate IS NULL)
	AND ([UserCreate] = @UserCreate OR @UserCreate IS NULL)
	AND ([DateModify] = @DateModify OR @DateModify IS NULL)
	AND ([UserModify] = @UserModify OR @UserModify IS NULL)
						
  END
  ELSE
  BEGIN
    SELECT
	  [Id]
	, [OriginalId]
	, [Title]
	, [Alias]
	, [ProductCode]
	, [Price]
	, [Size]
	, [Producer]
	, [Store]
	, [Promotion]
	, [Maintenance]
	, [Description]
	, [MenuId]
	, [MenuTitle]
	, [MenuAlias]
	, [MenuLink]
	, [Language]
	, [IsDisabled]
	, [IsRemoved]
	, [DateCreate]
	, [UserCreate]
	, [DateModify]
	, [UserModify]
    FROM
	[dbo].[tblProduct]
    WHERE 
	 ([Id] = @Id AND @Id is not null)
	OR ([OriginalId] = @OriginalId AND @OriginalId is not null)
	OR ([Title] = @Title AND @Title is not null)
	OR ([Alias] = @Alias AND @Alias is not null)
	OR ([ProductCode] = @ProductCode AND @ProductCode is not null)
	OR ([Price] = @Price AND @Price is not null)
	OR ([Size] = @Size AND @Size is not null)
	OR ([Producer] = @Producer AND @Producer is not null)
	OR ([Store] = @Store AND @Store is not null)
	OR ([Promotion] = @Promotion AND @Promotion is not null)
	OR ([Maintenance] = @Maintenance AND @Maintenance is not null)
	OR ([MenuId] = @MenuId AND @MenuId is not null)
	OR ([MenuTitle] = @MenuTitle AND @MenuTitle is not null)
	OR ([MenuAlias] = @MenuAlias AND @MenuAlias is not null)
	OR ([MenuLink] = @MenuLink AND @MenuLink is not null)
	OR ([Language] = @Language AND @Language is not null)
	OR ([IsDisabled] = @IsDisabled AND @IsDisabled is not null)
	OR ([IsRemoved] = @IsRemoved AND @IsRemoved is not null)
	OR ([DateCreate] = @DateCreate AND @DateCreate is not null)
	OR ([UserCreate] = @UserCreate AND @UserCreate is not null)
	OR ([DateModify] = @DateModify AND @DateModify is not null)
	OR ([UserModify] = @UserModify AND @UserModify is not null)
	SELECT @@ROWCOUNT			
  END
				

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblOrderDetail_Get_List procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblOrderDetail_Get_List') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblOrderDetail_Get_List
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Gets all records from the tblOrderDetail table
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblOrderDetail_Get_List

AS


				
				SELECT
					[Id],
					[ProductId],
					[ProductCode],
					[Price],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblOrderDetail]
					
				SELECT @@ROWCOUNT
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblOrderDetail_GetPaged procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblOrderDetail_GetPaged') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblOrderDetail_GetPaged
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Gets records from the tblOrderDetail table passing page index and page count parameters
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblOrderDetail_GetPaged
(

	@WhereClause varchar (2000)  ,

	@OrderBy varchar (2000)  ,

	@PageIndex int   ,

	@PageSize int   
)
AS


				
				BEGIN
				DECLARE @PageLowerBound int
				DECLARE @PageUpperBound int
				
				-- Set the page bounds
				SET @PageLowerBound = @PageSize * @PageIndex
				SET @PageUpperBound = @PageLowerBound + @PageSize

				-- Create a temp table to store the select results
				CREATE TABLE #PageIndex
				(
				    [IndexId] int IDENTITY (1, 1) NOT NULL,
				    [Id] bigint 
				)
				
				-- Insert into the temp table
				DECLARE @SQL AS nvarchar(4000)
				SET @SQL = 'INSERT INTO #PageIndex ([Id])'
				SET @SQL = @SQL + ' SELECT'
				IF @PageSize > 0
				BEGIN
					SET @SQL = @SQL + ' TOP ' + CONVERT(nvarchar, @PageUpperBound)
				END
				SET @SQL = @SQL + ' [Id]'
				SET @SQL = @SQL + ' FROM [dbo].[tblOrderDetail]'
				IF LEN(@WhereClause) > 0
				BEGIN
					SET @SQL = @SQL + ' WHERE ' + @WhereClause
				END
				IF LEN(@OrderBy) > 0
				BEGIN
					SET @SQL = @SQL + ' ORDER BY ' + @OrderBy
				END
				
				-- Populate the temp table
				EXEC sp_executesql @SQL

				-- Return paged results
				SELECT O.[Id], O.[ProductId], O.[ProductCode], O.[Price], O.[IsDisabled], O.[IsRemoved], O.[DateCreate], O.[UserCreate], O.[DateModify], O.[UserModify]
				FROM
				    [dbo].[tblOrderDetail] O,
				    #PageIndex PageIndex
				WHERE
				    PageIndex.IndexId > @PageLowerBound
					AND O.[Id] = PageIndex.[Id]
				ORDER BY
				    PageIndex.IndexId
				
				-- get row count
				SET @SQL = 'SELECT COUNT(*) AS TotalRowCount'
				SET @SQL = @SQL + ' FROM [dbo].[tblOrderDetail]'
				IF LEN(@WhereClause) > 0
				BEGIN
					SET @SQL = @SQL + ' WHERE ' + @WhereClause
				END
				EXEC sp_executesql @SQL
			
				END
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblOrderDetail_Insert procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblOrderDetail_Insert') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblOrderDetail_Insert
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Inserts a record into the tblOrderDetail table
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblOrderDetail_Insert
(

	@Id bigint    OUTPUT,

	@ProductId bigint   ,

	@ProductCode nvarchar (50)  ,

	@Price nvarchar (50)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   ,

	@DateCreate datetime   ,

	@UserCreate nvarchar (200)  ,

	@DateModify datetime   ,

	@UserModify nvarchar (200)  
)
AS


				
				INSERT INTO [dbo].[tblOrderDetail]
					(
					[ProductId]
					,[ProductCode]
					,[Price]
					,[IsDisabled]
					,[IsRemoved]
					,[DateCreate]
					,[UserCreate]
					,[DateModify]
					,[UserModify]
					)
				VALUES
					(
					@ProductId
					,@ProductCode
					,@Price
					,@IsDisabled
					,@IsRemoved
					,@DateCreate
					,@UserCreate
					,@DateModify
					,@UserModify
					)
				
				-- Get the identity value
				SET @Id = SCOPE_IDENTITY()
									
							
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblOrderDetail_Update procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblOrderDetail_Update') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblOrderDetail_Update
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Updates a record in the tblOrderDetail table
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblOrderDetail_Update
(

	@Id bigint   ,

	@ProductId bigint   ,

	@ProductCode nvarchar (50)  ,

	@Price nvarchar (50)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   ,

	@DateCreate datetime   ,

	@UserCreate nvarchar (200)  ,

	@DateModify datetime   ,

	@UserModify nvarchar (200)  
)
AS


				
				
				-- Modify the updatable columns
				UPDATE
					[dbo].[tblOrderDetail]
				SET
					[ProductId] = @ProductId
					,[ProductCode] = @ProductCode
					,[Price] = @Price
					,[IsDisabled] = @IsDisabled
					,[IsRemoved] = @IsRemoved
					,[DateCreate] = @DateCreate
					,[UserCreate] = @UserCreate
					,[DateModify] = @DateModify
					,[UserModify] = @UserModify
				WHERE
[Id] = @Id 
				
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblOrderDetail_Delete procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblOrderDetail_Delete') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblOrderDetail_Delete
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Deletes a record in the tblOrderDetail table
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblOrderDetail_Delete
(

	@Id bigint   
)
AS


				DELETE FROM [dbo].[tblOrderDetail] WITH (ROWLOCK) 
				WHERE
					[Id] = @Id
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblOrderDetail_GetByIdIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblOrderDetail_GetByIdIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblOrderDetail_GetByIdIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblOrderDetail table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblOrderDetail_GetByIdIsDisabled
(

	@Id bigint   ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[ProductId],
					[ProductCode],
					[Price],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblOrderDetail]
				WHERE
					[Id] = @Id
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblOrderDetail_GetByIdIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblOrderDetail_GetByIdIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblOrderDetail_GetByIdIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblOrderDetail table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblOrderDetail_GetByIdIsDisabledIsRemoved
(

	@Id bigint   ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[ProductId],
					[ProductCode],
					[Price],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblOrderDetail]
				WHERE
					[Id] = @Id
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblOrderDetail_GetByIdIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblOrderDetail_GetByIdIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblOrderDetail_GetByIdIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblOrderDetail table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblOrderDetail_GetByIdIsRemoved
(

	@Id bigint   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[ProductId],
					[ProductCode],
					[Price],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblOrderDetail]
				WHERE
					[Id] = @Id
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblOrderDetail_GetById procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblOrderDetail_GetById') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblOrderDetail_GetById
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblOrderDetail table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblOrderDetail_GetById
(

	@Id bigint   
)
AS


				SELECT
					[Id],
					[ProductId],
					[ProductCode],
					[Price],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblOrderDetail]
				WHERE
					[Id] = @Id
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblOrderDetail_Find procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblOrderDetail_Find') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblOrderDetail_Find
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Finds records in the tblOrderDetail table passing nullable parameters
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblOrderDetail_Find
(

	@SearchUsingOR bit   = null ,

	@Id bigint   = null ,

	@ProductId bigint   = null ,

	@ProductCode nvarchar (50)  = null ,

	@Price nvarchar (50)  = null ,

	@IsDisabled bit   = null ,

	@IsRemoved bit   = null ,

	@DateCreate datetime   = null ,

	@UserCreate nvarchar (200)  = null ,

	@DateModify datetime   = null ,

	@UserModify nvarchar (200)  = null 
)
AS


				
  IF ISNULL(@SearchUsingOR, 0) <> 1
  BEGIN
    SELECT
	  [Id]
	, [ProductId]
	, [ProductCode]
	, [Price]
	, [IsDisabled]
	, [IsRemoved]
	, [DateCreate]
	, [UserCreate]
	, [DateModify]
	, [UserModify]
    FROM
	[dbo].[tblOrderDetail]
    WHERE 
	 ([Id] = @Id OR @Id IS NULL)
	AND ([ProductId] = @ProductId OR @ProductId IS NULL)
	AND ([ProductCode] = @ProductCode OR @ProductCode IS NULL)
	AND ([Price] = @Price OR @Price IS NULL)
	AND ([IsDisabled] = @IsDisabled OR @IsDisabled IS NULL)
	AND ([IsRemoved] = @IsRemoved OR @IsRemoved IS NULL)
	AND ([DateCreate] = @DateCreate OR @DateCreate IS NULL)
	AND ([UserCreate] = @UserCreate OR @UserCreate IS NULL)
	AND ([DateModify] = @DateModify OR @DateModify IS NULL)
	AND ([UserModify] = @UserModify OR @UserModify IS NULL)
						
  END
  ELSE
  BEGIN
    SELECT
	  [Id]
	, [ProductId]
	, [ProductCode]
	, [Price]
	, [IsDisabled]
	, [IsRemoved]
	, [DateCreate]
	, [UserCreate]
	, [DateModify]
	, [UserModify]
    FROM
	[dbo].[tblOrderDetail]
    WHERE 
	 ([Id] = @Id AND @Id is not null)
	OR ([ProductId] = @ProductId AND @ProductId is not null)
	OR ([ProductCode] = @ProductCode AND @ProductCode is not null)
	OR ([Price] = @Price AND @Price is not null)
	OR ([IsDisabled] = @IsDisabled AND @IsDisabled is not null)
	OR ([IsRemoved] = @IsRemoved AND @IsRemoved is not null)
	OR ([DateCreate] = @DateCreate AND @DateCreate is not null)
	OR ([UserCreate] = @UserCreate AND @UserCreate is not null)
	OR ([DateModify] = @DateModify AND @DateModify is not null)
	OR ([UserModify] = @UserModify AND @UserModify is not null)
	SELECT @@ROWCOUNT			
  END
				

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblOrder_Get_List procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblOrder_Get_List') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblOrder_Get_List
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Gets all records from the tblOrder table
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblOrder_Get_List

AS


				
				SELECT
					[Id],
					[Username],
					[TotalPrice],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblOrder]
					
				SELECT @@ROWCOUNT
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblOrder_GetPaged procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblOrder_GetPaged') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblOrder_GetPaged
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Gets records from the tblOrder table passing page index and page count parameters
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblOrder_GetPaged
(

	@WhereClause varchar (2000)  ,

	@OrderBy varchar (2000)  ,

	@PageIndex int   ,

	@PageSize int   
)
AS


				
				BEGIN
				DECLARE @PageLowerBound int
				DECLARE @PageUpperBound int
				
				-- Set the page bounds
				SET @PageLowerBound = @PageSize * @PageIndex
				SET @PageUpperBound = @PageLowerBound + @PageSize

				-- Create a temp table to store the select results
				CREATE TABLE #PageIndex
				(
				    [IndexId] int IDENTITY (1, 1) NOT NULL,
				    [Id] bigint 
				)
				
				-- Insert into the temp table
				DECLARE @SQL AS nvarchar(4000)
				SET @SQL = 'INSERT INTO #PageIndex ([Id])'
				SET @SQL = @SQL + ' SELECT'
				IF @PageSize > 0
				BEGIN
					SET @SQL = @SQL + ' TOP ' + CONVERT(nvarchar, @PageUpperBound)
				END
				SET @SQL = @SQL + ' [Id]'
				SET @SQL = @SQL + ' FROM [dbo].[tblOrder]'
				IF LEN(@WhereClause) > 0
				BEGIN
					SET @SQL = @SQL + ' WHERE ' + @WhereClause
				END
				IF LEN(@OrderBy) > 0
				BEGIN
					SET @SQL = @SQL + ' ORDER BY ' + @OrderBy
				END
				
				-- Populate the temp table
				EXEC sp_executesql @SQL

				-- Return paged results
				SELECT O.[Id], O.[Username], O.[TotalPrice], O.[IsDisabled], O.[IsRemoved], O.[DateCreate], O.[UserCreate], O.[DateModify], O.[UserModify]
				FROM
				    [dbo].[tblOrder] O,
				    #PageIndex PageIndex
				WHERE
				    PageIndex.IndexId > @PageLowerBound
					AND O.[Id] = PageIndex.[Id]
				ORDER BY
				    PageIndex.IndexId
				
				-- get row count
				SET @SQL = 'SELECT COUNT(*) AS TotalRowCount'
				SET @SQL = @SQL + ' FROM [dbo].[tblOrder]'
				IF LEN(@WhereClause) > 0
				BEGIN
					SET @SQL = @SQL + ' WHERE ' + @WhereClause
				END
				EXEC sp_executesql @SQL
			
				END
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblOrder_Insert procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblOrder_Insert') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblOrder_Insert
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Inserts a record into the tblOrder table
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblOrder_Insert
(

	@Id bigint    OUTPUT,

	@Username nvarchar (200)  ,

	@TotalPrice decimal (18, 0)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   ,

	@DateCreate datetime   ,

	@UserCreate nvarchar (200)  ,

	@DateModify datetime   ,

	@UserModify nvarchar (200)  
)
AS


				
				INSERT INTO [dbo].[tblOrder]
					(
					[Username]
					,[TotalPrice]
					,[IsDisabled]
					,[IsRemoved]
					,[DateCreate]
					,[UserCreate]
					,[DateModify]
					,[UserModify]
					)
				VALUES
					(
					@Username
					,@TotalPrice
					,@IsDisabled
					,@IsRemoved
					,@DateCreate
					,@UserCreate
					,@DateModify
					,@UserModify
					)
				
				-- Get the identity value
				SET @Id = SCOPE_IDENTITY()
									
							
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblOrder_Update procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblOrder_Update') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblOrder_Update
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Updates a record in the tblOrder table
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblOrder_Update
(

	@Id bigint   ,

	@Username nvarchar (200)  ,

	@TotalPrice decimal (18, 0)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   ,

	@DateCreate datetime   ,

	@UserCreate nvarchar (200)  ,

	@DateModify datetime   ,

	@UserModify nvarchar (200)  
)
AS


				
				
				-- Modify the updatable columns
				UPDATE
					[dbo].[tblOrder]
				SET
					[Username] = @Username
					,[TotalPrice] = @TotalPrice
					,[IsDisabled] = @IsDisabled
					,[IsRemoved] = @IsRemoved
					,[DateCreate] = @DateCreate
					,[UserCreate] = @UserCreate
					,[DateModify] = @DateModify
					,[UserModify] = @UserModify
				WHERE
[Id] = @Id 
				
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblOrder_Delete procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblOrder_Delete') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblOrder_Delete
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Deletes a record in the tblOrder table
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblOrder_Delete
(

	@Id bigint   
)
AS


				DELETE FROM [dbo].[tblOrder] WITH (ROWLOCK) 
				WHERE
					[Id] = @Id
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblOrder_GetByIdIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblOrder_GetByIdIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblOrder_GetByIdIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblOrder table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblOrder_GetByIdIsDisabled
(

	@Id bigint   ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[Username],
					[TotalPrice],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblOrder]
				WHERE
					[Id] = @Id
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblOrder_GetByIdIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblOrder_GetByIdIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblOrder_GetByIdIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblOrder table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblOrder_GetByIdIsDisabledIsRemoved
(

	@Id bigint   ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[Username],
					[TotalPrice],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblOrder]
				WHERE
					[Id] = @Id
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblOrder_GetByIdIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblOrder_GetByIdIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblOrder_GetByIdIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblOrder table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblOrder_GetByIdIsRemoved
(

	@Id bigint   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[Username],
					[TotalPrice],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblOrder]
				WHERE
					[Id] = @Id
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblOrder_GetByIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblOrder_GetByIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblOrder_GetByIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblOrder table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblOrder_GetByIsDisabled
(

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[Username],
					[TotalPrice],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblOrder]
				WHERE
					[IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblOrder_GetByIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblOrder_GetByIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblOrder_GetByIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblOrder table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblOrder_GetByIsDisabledIsRemoved
(

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[Username],
					[TotalPrice],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblOrder]
				WHERE
					[IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblOrder_GetByIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblOrder_GetByIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblOrder_GetByIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblOrder table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblOrder_GetByIsRemoved
(

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[Username],
					[TotalPrice],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblOrder]
				WHERE
					[IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblOrder_GetById procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblOrder_GetById') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblOrder_GetById
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblOrder table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblOrder_GetById
(

	@Id bigint   
)
AS


				SELECT
					[Id],
					[Username],
					[TotalPrice],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblOrder]
				WHERE
					[Id] = @Id
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblOrder_Find procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblOrder_Find') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblOrder_Find
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Finds records in the tblOrder table passing nullable parameters
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblOrder_Find
(

	@SearchUsingOR bit   = null ,

	@Id bigint   = null ,

	@Username nvarchar (200)  = null ,

	@TotalPrice decimal (18, 0)  = null ,

	@IsDisabled bit   = null ,

	@IsRemoved bit   = null ,

	@DateCreate datetime   = null ,

	@UserCreate nvarchar (200)  = null ,

	@DateModify datetime   = null ,

	@UserModify nvarchar (200)  = null 
)
AS


				
  IF ISNULL(@SearchUsingOR, 0) <> 1
  BEGIN
    SELECT
	  [Id]
	, [Username]
	, [TotalPrice]
	, [IsDisabled]
	, [IsRemoved]
	, [DateCreate]
	, [UserCreate]
	, [DateModify]
	, [UserModify]
    FROM
	[dbo].[tblOrder]
    WHERE 
	 ([Id] = @Id OR @Id IS NULL)
	AND ([Username] = @Username OR @Username IS NULL)
	AND ([TotalPrice] = @TotalPrice OR @TotalPrice IS NULL)
	AND ([IsDisabled] = @IsDisabled OR @IsDisabled IS NULL)
	AND ([IsRemoved] = @IsRemoved OR @IsRemoved IS NULL)
	AND ([DateCreate] = @DateCreate OR @DateCreate IS NULL)
	AND ([UserCreate] = @UserCreate OR @UserCreate IS NULL)
	AND ([DateModify] = @DateModify OR @DateModify IS NULL)
	AND ([UserModify] = @UserModify OR @UserModify IS NULL)
						
  END
  ELSE
  BEGIN
    SELECT
	  [Id]
	, [Username]
	, [TotalPrice]
	, [IsDisabled]
	, [IsRemoved]
	, [DateCreate]
	, [UserCreate]
	, [DateModify]
	, [UserModify]
    FROM
	[dbo].[tblOrder]
    WHERE 
	 ([Id] = @Id AND @Id is not null)
	OR ([Username] = @Username AND @Username is not null)
	OR ([TotalPrice] = @TotalPrice AND @TotalPrice is not null)
	OR ([IsDisabled] = @IsDisabled AND @IsDisabled is not null)
	OR ([IsRemoved] = @IsRemoved AND @IsRemoved is not null)
	OR ([DateCreate] = @DateCreate AND @DateCreate is not null)
	OR ([UserCreate] = @UserCreate AND @UserCreate is not null)
	OR ([DateModify] = @DateModify AND @DateModify is not null)
	OR ([UserModify] = @UserModify AND @UserModify is not null)
	SELECT @@ROWCOUNT			
  END
				

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_Get_List procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_Get_List') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_Get_List
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Gets all records from the tblMenu table
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_Get_List

AS


				
				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
					
				SELECT @@ROWCOUNT
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetPaged procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetPaged') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetPaged
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Gets records from the tblMenu table passing page index and page count parameters
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetPaged
(

	@WhereClause varchar (2000)  ,

	@OrderBy varchar (2000)  ,

	@PageIndex int   ,

	@PageSize int   
)
AS


				
				BEGIN
				DECLARE @PageLowerBound int
				DECLARE @PageUpperBound int
				
				-- Set the page bounds
				SET @PageLowerBound = @PageSize * @PageIndex
				SET @PageUpperBound = @PageLowerBound + @PageSize

				-- Create a temp table to store the select results
				CREATE TABLE #PageIndex
				(
				    [IndexId] int IDENTITY (1, 1) NOT NULL,
				    [Id] bigint 
				)
				
				-- Insert into the temp table
				DECLARE @SQL AS nvarchar(4000)
				SET @SQL = 'INSERT INTO #PageIndex ([Id])'
				SET @SQL = @SQL + ' SELECT'
				IF @PageSize > 0
				BEGIN
					SET @SQL = @SQL + ' TOP ' + CONVERT(nvarchar, @PageUpperBound)
				END
				SET @SQL = @SQL + ' [Id]'
				SET @SQL = @SQL + ' FROM [dbo].[tblMenu]'
				IF LEN(@WhereClause) > 0
				BEGIN
					SET @SQL = @SQL + ' WHERE ' + @WhereClause
				END
				IF LEN(@OrderBy) > 0
				BEGIN
					SET @SQL = @SQL + ' ORDER BY ' + @OrderBy
				END
				
				-- Populate the temp table
				EXEC sp_executesql @SQL

				-- Return paged results
				SELECT O.[Id], O.[ParentId], O.[OriginalId], O.[Title], O.[Alias], O.[MenuType], O.[Link], O.[Language], O.[IsDisabled], O.[IsRemoved], O.[IsProduct], O.[DateCreate], O.[UserCreate], O.[DateModify], O.[UserModify]
				FROM
				    [dbo].[tblMenu] O,
				    #PageIndex PageIndex
				WHERE
				    PageIndex.IndexId > @PageLowerBound
					AND O.[Id] = PageIndex.[Id]
				ORDER BY
				    PageIndex.IndexId
				
				-- get row count
				SET @SQL = 'SELECT COUNT(*) AS TotalRowCount'
				SET @SQL = @SQL + ' FROM [dbo].[tblMenu]'
				IF LEN(@WhereClause) > 0
				BEGIN
					SET @SQL = @SQL + ' WHERE ' + @WhereClause
				END
				EXEC sp_executesql @SQL
			
				END
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_Insert procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_Insert') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_Insert
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Inserts a record into the tblMenu table
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_Insert
(

	@Id bigint    OUTPUT,

	@ParentId bigint   ,

	@OriginalId bigint   ,

	@Title nvarchar (200)  ,

	@Alias nvarchar (200)  ,

	@MenuType nvarchar (50)  ,

	@Link nvarchar (200)  ,

	@Language nvarchar (20)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   ,

	@IsProduct bit   ,

	@DateCreate datetime   ,

	@UserCreate nvarchar (200)  ,

	@DateModify datetime   ,

	@UserModify nvarchar (200)  
)
AS


				
				INSERT INTO [dbo].[tblMenu]
					(
					[ParentId]
					,[OriginalId]
					,[Title]
					,[Alias]
					,[MenuType]
					,[Link]
					,[Language]
					,[IsDisabled]
					,[IsRemoved]
					,[IsProduct]
					,[DateCreate]
					,[UserCreate]
					,[DateModify]
					,[UserModify]
					)
				VALUES
					(
					@ParentId
					,@OriginalId
					,@Title
					,@Alias
					,@MenuType
					,@Link
					,@Language
					,@IsDisabled
					,@IsRemoved
					,@IsProduct
					,@DateCreate
					,@UserCreate
					,@DateModify
					,@UserModify
					)
				
				-- Get the identity value
				SET @Id = SCOPE_IDENTITY()
									
							
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_Update procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_Update') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_Update
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Updates a record in the tblMenu table
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_Update
(

	@Id bigint   ,

	@ParentId bigint   ,

	@OriginalId bigint   ,

	@Title nvarchar (200)  ,

	@Alias nvarchar (200)  ,

	@MenuType nvarchar (50)  ,

	@Link nvarchar (200)  ,

	@Language nvarchar (20)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   ,

	@IsProduct bit   ,

	@DateCreate datetime   ,

	@UserCreate nvarchar (200)  ,

	@DateModify datetime   ,

	@UserModify nvarchar (200)  
)
AS


				
				
				-- Modify the updatable columns
				UPDATE
					[dbo].[tblMenu]
				SET
					[ParentId] = @ParentId
					,[OriginalId] = @OriginalId
					,[Title] = @Title
					,[Alias] = @Alias
					,[MenuType] = @MenuType
					,[Link] = @Link
					,[Language] = @Language
					,[IsDisabled] = @IsDisabled
					,[IsRemoved] = @IsRemoved
					,[IsProduct] = @IsProduct
					,[DateCreate] = @DateCreate
					,[UserCreate] = @UserCreate
					,[DateModify] = @DateModify
					,[UserModify] = @UserModify
				WHERE
[Id] = @Id 
				
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_Delete procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_Delete') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_Delete
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Deletes a record in the tblMenu table
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_Delete
(

	@Id bigint   
)
AS


				DELETE FROM [dbo].[tblMenu] WITH (ROWLOCK) 
				WHERE
					[Id] = @Id
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByAlias procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByAlias') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByAlias
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByAlias
(

	@Alias nvarchar (200)  
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Alias] = @Alias
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByAliasIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByAliasIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByAliasIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByAliasIsDisabled
(

	@Alias nvarchar (200)  ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Alias] = @Alias
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByAliasIsDisabledIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByAliasIsDisabledIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByAliasIsDisabledIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByAliasIsDisabledIsProduct
(

	@Alias nvarchar (200)  ,

	@IsDisabled bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Alias] = @Alias
					AND [IsDisabled] = @IsDisabled
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByAliasIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByAliasIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByAliasIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByAliasIsDisabledIsRemoved
(

	@Alias nvarchar (200)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Alias] = @Alias
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByAliasIsDisabledIsRemovedIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByAliasIsDisabledIsRemovedIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByAliasIsDisabledIsRemovedIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByAliasIsDisabledIsRemovedIsProduct
(

	@Alias nvarchar (200)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Alias] = @Alias
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByAliasIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByAliasIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByAliasIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByAliasIsProduct
(

	@Alias nvarchar (200)  ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Alias] = @Alias
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByAliasIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByAliasIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByAliasIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByAliasIsRemoved
(

	@Alias nvarchar (200)  ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Alias] = @Alias
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByAliasIsRemovedIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByAliasIsRemovedIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByAliasIsRemovedIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByAliasIsRemovedIsProduct
(

	@Alias nvarchar (200)  ,

	@IsRemoved bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Alias] = @Alias
					AND [IsRemoved] = @IsRemoved
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdIsDisabled
(

	@Id bigint   ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdIsDisabledIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdIsDisabledIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdIsDisabledIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdIsDisabledIsProduct
(

	@Id bigint   ,

	@IsDisabled bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [IsDisabled] = @IsDisabled
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdIsDisabledIsRemoved
(

	@Id bigint   ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdIsDisabledIsRemovedIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdIsDisabledIsRemovedIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdIsDisabledIsRemovedIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdIsDisabledIsRemovedIsProduct
(

	@Id bigint   ,

	@IsDisabled bit   ,

	@IsRemoved bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdIsProduct
(

	@Id bigint   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdIsRemoved
(

	@Id bigint   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdIsRemovedIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdIsRemovedIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdIsRemovedIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdIsRemovedIsProduct
(

	@Id bigint   ,

	@IsRemoved bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [IsRemoved] = @IsRemoved
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdLanguage procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdLanguage') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdLanguage
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdLanguage
(

	@Id bigint   ,

	@Language nvarchar (20)  
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [Language] = @Language
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdLanguageIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdLanguageIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdLanguageIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdLanguageIsDisabled
(

	@Id bigint   ,

	@Language nvarchar (20)  ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [Language] = @Language
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdLanguageIsDisabledIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdLanguageIsDisabledIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdLanguageIsDisabledIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdLanguageIsDisabledIsProduct
(

	@Id bigint   ,

	@Language nvarchar (20)  ,

	@IsDisabled bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [Language] = @Language
					AND [IsDisabled] = @IsDisabled
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdLanguageIsDisabledIsProductIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdLanguageIsDisabledIsProductIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdLanguageIsDisabledIsProductIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdLanguageIsDisabledIsProductIsRemoved
(

	@Id bigint   ,

	@Language nvarchar (20)  ,

	@IsDisabled bit   ,

	@IsProduct bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [Language] = @Language
					AND [IsDisabled] = @IsDisabled
					AND [IsProduct] = @IsProduct
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdLanguageIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdLanguageIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdLanguageIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdLanguageIsDisabledIsRemoved
(

	@Id bigint   ,

	@Language nvarchar (20)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [Language] = @Language
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdLanguageIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdLanguageIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdLanguageIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdLanguageIsProduct
(

	@Id bigint   ,

	@Language nvarchar (20)  ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [Language] = @Language
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdLanguageIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdLanguageIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdLanguageIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdLanguageIsRemoved
(

	@Id bigint   ,

	@Language nvarchar (20)  ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [Language] = @Language
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdOriginalId procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdOriginalId') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdOriginalId
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdOriginalId
(

	@Id bigint   ,

	@OriginalId bigint   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [OriginalId] = @OriginalId
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdOriginalIdIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdOriginalIdIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdOriginalIdIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdOriginalIdIsDisabled
(

	@Id bigint   ,

	@OriginalId bigint   ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [OriginalId] = @OriginalId
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdOriginalIdIsDisabledIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdOriginalIdIsDisabledIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdOriginalIdIsDisabledIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdOriginalIdIsDisabledIsProduct
(

	@Id bigint   ,

	@OriginalId bigint   ,

	@IsDisabled bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [OriginalId] = @OriginalId
					AND [IsDisabled] = @IsDisabled
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdOriginalIdIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdOriginalIdIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdOriginalIdIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdOriginalIdIsDisabledIsRemoved
(

	@Id bigint   ,

	@OriginalId bigint   ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [OriginalId] = @OriginalId
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdOriginalIdIsDisabledIsRemovedIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdOriginalIdIsDisabledIsRemovedIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdOriginalIdIsDisabledIsRemovedIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdOriginalIdIsDisabledIsRemovedIsProduct
(

	@Id bigint   ,

	@OriginalId bigint   ,

	@IsDisabled bit   ,

	@IsRemoved bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [OriginalId] = @OriginalId
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdOriginalIdIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdOriginalIdIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdOriginalIdIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdOriginalIdIsProduct
(

	@Id bigint   ,

	@OriginalId bigint   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [OriginalId] = @OriginalId
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdOriginalIdIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdOriginalIdIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdOriginalIdIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdOriginalIdIsRemoved
(

	@Id bigint   ,

	@OriginalId bigint   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [OriginalId] = @OriginalId
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdOriginalIdIsRemovedIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdOriginalIdIsRemovedIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdOriginalIdIsRemovedIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdOriginalIdIsRemovedIsProduct
(

	@Id bigint   ,

	@OriginalId bigint   ,

	@IsRemoved bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [OriginalId] = @OriginalId
					AND [IsRemoved] = @IsRemoved
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdParentId procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdParentId') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdParentId
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdParentId
(

	@Id bigint   ,

	@ParentId bigint   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [ParentId] = @ParentId
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdParentIdIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdParentIdIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdParentIdIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdParentIdIsDisabled
(

	@Id bigint   ,

	@ParentId bigint   ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [ParentId] = @ParentId
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdParentIdIsDisabledIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdParentIdIsDisabledIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdParentIdIsDisabledIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdParentIdIsDisabledIsProduct
(

	@Id bigint   ,

	@ParentId bigint   ,

	@IsDisabled bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [ParentId] = @ParentId
					AND [IsDisabled] = @IsDisabled
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdParentIdIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdParentIdIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdParentIdIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdParentIdIsDisabledIsRemoved
(

	@Id bigint   ,

	@ParentId bigint   ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [ParentId] = @ParentId
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdParentIdIsDisabledIsRemovedIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdParentIdIsDisabledIsRemovedIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdParentIdIsDisabledIsRemovedIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdParentIdIsDisabledIsRemovedIsProduct
(

	@Id bigint   ,

	@ParentId bigint   ,

	@IsDisabled bit   ,

	@IsRemoved bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [ParentId] = @ParentId
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdParentIdIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdParentIdIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdParentIdIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdParentIdIsProduct
(

	@Id bigint   ,

	@ParentId bigint   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [ParentId] = @ParentId
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdParentIdIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdParentIdIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdParentIdIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdParentIdIsRemoved
(

	@Id bigint   ,

	@ParentId bigint   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [ParentId] = @ParentId
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByIdParentIdIsRemovedIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByIdParentIdIsRemovedIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByIdParentIdIsRemovedIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByIdParentIdIsRemovedIsProduct
(

	@Id bigint   ,

	@ParentId bigint   ,

	@IsRemoved bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
					AND [ParentId] = @ParentId
					AND [IsRemoved] = @IsRemoved
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByLanguageIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByLanguageIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByLanguageIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByLanguageIsDisabled
(

	@Language nvarchar (20)  ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Language] = @Language
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByLanguageIsDisabledIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByLanguageIsDisabledIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByLanguageIsDisabledIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByLanguageIsDisabledIsProduct
(

	@Language nvarchar (20)  ,

	@IsDisabled bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Language] = @Language
					AND [IsDisabled] = @IsDisabled
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByLanguageIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByLanguageIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByLanguageIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByLanguageIsDisabledIsRemoved
(

	@Language nvarchar (20)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Language] = @Language
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByLanguageIsDisabledIsRemovedIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByLanguageIsDisabledIsRemovedIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByLanguageIsDisabledIsRemovedIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByLanguageIsDisabledIsRemovedIsProduct
(

	@Language nvarchar (20)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Language] = @Language
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByLanguageIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByLanguageIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByLanguageIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByLanguageIsProduct
(

	@Language nvarchar (20)  ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Language] = @Language
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByLanguageIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByLanguageIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByLanguageIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByLanguageIsRemoved
(

	@Language nvarchar (20)  ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Language] = @Language
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByLanguageIsRemovedIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByLanguageIsRemovedIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByLanguageIsRemovedIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByLanguageIsRemovedIsProduct
(

	@Language nvarchar (20)  ,

	@IsRemoved bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Language] = @Language
					AND [IsRemoved] = @IsRemoved
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByOriginalId procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByOriginalId') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByOriginalId
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByOriginalId
(

	@OriginalId bigint   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[OriginalId] = @OriginalId
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByOriginalIdIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByOriginalIdIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByOriginalIdIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByOriginalIdIsDisabled
(

	@OriginalId bigint   ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[OriginalId] = @OriginalId
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByOriginalIdIsDisabledIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByOriginalIdIsDisabledIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByOriginalIdIsDisabledIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByOriginalIdIsDisabledIsProduct
(

	@OriginalId bigint   ,

	@IsDisabled bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[OriginalId] = @OriginalId
					AND [IsDisabled] = @IsDisabled
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByOriginalIdIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByOriginalIdIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByOriginalIdIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByOriginalIdIsDisabledIsRemoved
(

	@OriginalId bigint   ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[OriginalId] = @OriginalId
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByOriginalIdIsDisabledIsRemovedIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByOriginalIdIsDisabledIsRemovedIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByOriginalIdIsDisabledIsRemovedIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByOriginalIdIsDisabledIsRemovedIsProduct
(

	@OriginalId bigint   ,

	@IsDisabled bit   ,

	@IsRemoved bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[OriginalId] = @OriginalId
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByOriginalIdIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByOriginalIdIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByOriginalIdIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByOriginalIdIsProduct
(

	@OriginalId bigint   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[OriginalId] = @OriginalId
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByOriginalIdIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByOriginalIdIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByOriginalIdIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByOriginalIdIsRemoved
(

	@OriginalId bigint   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[OriginalId] = @OriginalId
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByOriginalIdIsRemovedIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByOriginalIdIsRemovedIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByOriginalIdIsRemovedIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByOriginalIdIsRemovedIsProduct
(

	@OriginalId bigint   ,

	@IsRemoved bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[OriginalId] = @OriginalId
					AND [IsRemoved] = @IsRemoved
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByOriginalIdParentId procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByOriginalIdParentId') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByOriginalIdParentId
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByOriginalIdParentId
(

	@OriginalId bigint   ,

	@ParentId bigint   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[OriginalId] = @OriginalId
					AND [ParentId] = @ParentId
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByOriginalIdParentIdIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByOriginalIdParentIdIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByOriginalIdParentIdIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByOriginalIdParentIdIsDisabled
(

	@OriginalId bigint   ,

	@ParentId bigint   ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[OriginalId] = @OriginalId
					AND [ParentId] = @ParentId
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByOriginalIdParentIdIsDisabledIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByOriginalIdParentIdIsDisabledIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByOriginalIdParentIdIsDisabledIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByOriginalIdParentIdIsDisabledIsProduct
(

	@OriginalId bigint   ,

	@ParentId bigint   ,

	@IsDisabled bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[OriginalId] = @OriginalId
					AND [ParentId] = @ParentId
					AND [IsDisabled] = @IsDisabled
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByOriginalIdParentIdIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByOriginalIdParentIdIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByOriginalIdParentIdIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByOriginalIdParentIdIsDisabledIsRemoved
(

	@OriginalId bigint   ,

	@ParentId bigint   ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[OriginalId] = @OriginalId
					AND [ParentId] = @ParentId
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByOriginalIdParentIdIsDisabledIsRemovedIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByOriginalIdParentIdIsDisabledIsRemovedIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByOriginalIdParentIdIsDisabledIsRemovedIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByOriginalIdParentIdIsDisabledIsRemovedIsProduct
(

	@OriginalId bigint   ,

	@ParentId bigint   ,

	@IsDisabled bit   ,

	@IsRemoved bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[OriginalId] = @OriginalId
					AND [ParentId] = @ParentId
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByOriginalIdParentIdIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByOriginalIdParentIdIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByOriginalIdParentIdIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByOriginalIdParentIdIsProduct
(

	@OriginalId bigint   ,

	@ParentId bigint   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[OriginalId] = @OriginalId
					AND [ParentId] = @ParentId
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByOriginalIdParentIdIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByOriginalIdParentIdIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByOriginalIdParentIdIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByOriginalIdParentIdIsRemoved
(

	@OriginalId bigint   ,

	@ParentId bigint   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[OriginalId] = @OriginalId
					AND [ParentId] = @ParentId
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByOriginalIdParentIdIsRemovedIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByOriginalIdParentIdIsRemovedIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByOriginalIdParentIdIsRemovedIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByOriginalIdParentIdIsRemovedIsProduct
(

	@OriginalId bigint   ,

	@ParentId bigint   ,

	@IsRemoved bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[OriginalId] = @OriginalId
					AND [ParentId] = @ParentId
					AND [IsRemoved] = @IsRemoved
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByParentId procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByParentId') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByParentId
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByParentId
(

	@ParentId bigint   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[ParentId] = @ParentId
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByParentIdIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByParentIdIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByParentIdIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByParentIdIsDisabled
(

	@ParentId bigint   ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[ParentId] = @ParentId
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByParentIdIsDisabledIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByParentIdIsDisabledIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByParentIdIsDisabledIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByParentIdIsDisabledIsProduct
(

	@ParentId bigint   ,

	@IsDisabled bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[ParentId] = @ParentId
					AND [IsDisabled] = @IsDisabled
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByParentIdIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByParentIdIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByParentIdIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByParentIdIsDisabledIsRemoved
(

	@ParentId bigint   ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[ParentId] = @ParentId
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByParentIdIsDisabledIsRemovedIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByParentIdIsDisabledIsRemovedIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByParentIdIsDisabledIsRemovedIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByParentIdIsDisabledIsRemovedIsProduct
(

	@ParentId bigint   ,

	@IsDisabled bit   ,

	@IsRemoved bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[ParentId] = @ParentId
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByParentIdIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByParentIdIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByParentIdIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByParentIdIsProduct
(

	@ParentId bigint   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[ParentId] = @ParentId
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByParentIdIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByParentIdIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByParentIdIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByParentIdIsRemoved
(

	@ParentId bigint   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[ParentId] = @ParentId
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByParentIdIsRemovedIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByParentIdIsRemovedIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByParentIdIsRemovedIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByParentIdIsRemovedIsProduct
(

	@ParentId bigint   ,

	@IsRemoved bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[ParentId] = @ParentId
					AND [IsRemoved] = @IsRemoved
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByParentIdLanguage procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByParentIdLanguage') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByParentIdLanguage
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByParentIdLanguage
(

	@ParentId bigint   ,

	@Language nvarchar (20)  
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[ParentId] = @ParentId
					AND [Language] = @Language
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByParentIdLanguageIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByParentIdLanguageIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByParentIdLanguageIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByParentIdLanguageIsDisabled
(

	@ParentId bigint   ,

	@Language nvarchar (20)  ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[ParentId] = @ParentId
					AND [Language] = @Language
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByParentIdLanguageIsDisabledIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByParentIdLanguageIsDisabledIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByParentIdLanguageIsDisabledIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByParentIdLanguageIsDisabledIsProduct
(

	@ParentId bigint   ,

	@Language nvarchar (20)  ,

	@IsDisabled bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[ParentId] = @ParentId
					AND [Language] = @Language
					AND [IsDisabled] = @IsDisabled
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByParentIdLanguageIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByParentIdLanguageIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByParentIdLanguageIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByParentIdLanguageIsDisabledIsRemoved
(

	@ParentId bigint   ,

	@Language nvarchar (20)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[ParentId] = @ParentId
					AND [Language] = @Language
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByParentIdLanguageIsDisabledIsRemovedIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByParentIdLanguageIsDisabledIsRemovedIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByParentIdLanguageIsDisabledIsRemovedIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByParentIdLanguageIsDisabledIsRemovedIsProduct
(

	@ParentId bigint   ,

	@Language nvarchar (20)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[ParentId] = @ParentId
					AND [Language] = @Language
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByParentIdLanguageIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByParentIdLanguageIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByParentIdLanguageIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByParentIdLanguageIsProduct
(

	@ParentId bigint   ,

	@Language nvarchar (20)  ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[ParentId] = @ParentId
					AND [Language] = @Language
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByParentIdLanguageIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByParentIdLanguageIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByParentIdLanguageIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByParentIdLanguageIsRemoved
(

	@ParentId bigint   ,

	@Language nvarchar (20)  ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[ParentId] = @ParentId
					AND [Language] = @Language
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetByParentIdLanguageIsRemovedIsProduct procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetByParentIdLanguageIsRemovedIsProduct') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetByParentIdLanguageIsRemovedIsProduct
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetByParentIdLanguageIsRemovedIsProduct
(

	@ParentId bigint   ,

	@Language nvarchar (20)  ,

	@IsRemoved bit   ,

	@IsProduct bit   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[ParentId] = @ParentId
					AND [Language] = @Language
					AND [IsRemoved] = @IsRemoved
					AND [IsProduct] = @IsProduct
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_GetById procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_GetById') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_GetById
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblMenu table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_GetById
(

	@Id bigint   
)
AS


				SELECT
					[Id],
					[ParentId],
					[OriginalId],
					[Title],
					[Alias],
					[MenuType],
					[Link],
					[Language],
					[IsDisabled],
					[IsRemoved],
					[IsProduct],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblMenu]
				WHERE
					[Id] = @Id
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblMenu_Find procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblMenu_Find') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblMenu_Find
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Finds records in the tblMenu table passing nullable parameters
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblMenu_Find
(

	@SearchUsingOR bit   = null ,

	@Id bigint   = null ,

	@ParentId bigint   = null ,

	@OriginalId bigint   = null ,

	@Title nvarchar (200)  = null ,

	@Alias nvarchar (200)  = null ,

	@MenuType nvarchar (50)  = null ,

	@Link nvarchar (200)  = null ,

	@Language nvarchar (20)  = null ,

	@IsDisabled bit   = null ,

	@IsRemoved bit   = null ,

	@IsProduct bit   = null ,

	@DateCreate datetime   = null ,

	@UserCreate nvarchar (200)  = null ,

	@DateModify datetime   = null ,

	@UserModify nvarchar (200)  = null 
)
AS


				
  IF ISNULL(@SearchUsingOR, 0) <> 1
  BEGIN
    SELECT
	  [Id]
	, [ParentId]
	, [OriginalId]
	, [Title]
	, [Alias]
	, [MenuType]
	, [Link]
	, [Language]
	, [IsDisabled]
	, [IsRemoved]
	, [IsProduct]
	, [DateCreate]
	, [UserCreate]
	, [DateModify]
	, [UserModify]
    FROM
	[dbo].[tblMenu]
    WHERE 
	 ([Id] = @Id OR @Id IS NULL)
	AND ([ParentId] = @ParentId OR @ParentId IS NULL)
	AND ([OriginalId] = @OriginalId OR @OriginalId IS NULL)
	AND ([Title] = @Title OR @Title IS NULL)
	AND ([Alias] = @Alias OR @Alias IS NULL)
	AND ([MenuType] = @MenuType OR @MenuType IS NULL)
	AND ([Link] = @Link OR @Link IS NULL)
	AND ([Language] = @Language OR @Language IS NULL)
	AND ([IsDisabled] = @IsDisabled OR @IsDisabled IS NULL)
	AND ([IsRemoved] = @IsRemoved OR @IsRemoved IS NULL)
	AND ([IsProduct] = @IsProduct OR @IsProduct IS NULL)
	AND ([DateCreate] = @DateCreate OR @DateCreate IS NULL)
	AND ([UserCreate] = @UserCreate OR @UserCreate IS NULL)
	AND ([DateModify] = @DateModify OR @DateModify IS NULL)
	AND ([UserModify] = @UserModify OR @UserModify IS NULL)
						
  END
  ELSE
  BEGIN
    SELECT
	  [Id]
	, [ParentId]
	, [OriginalId]
	, [Title]
	, [Alias]
	, [MenuType]
	, [Link]
	, [Language]
	, [IsDisabled]
	, [IsRemoved]
	, [IsProduct]
	, [DateCreate]
	, [UserCreate]
	, [DateModify]
	, [UserModify]
    FROM
	[dbo].[tblMenu]
    WHERE 
	 ([Id] = @Id AND @Id is not null)
	OR ([ParentId] = @ParentId AND @ParentId is not null)
	OR ([OriginalId] = @OriginalId AND @OriginalId is not null)
	OR ([Title] = @Title AND @Title is not null)
	OR ([Alias] = @Alias AND @Alias is not null)
	OR ([MenuType] = @MenuType AND @MenuType is not null)
	OR ([Link] = @Link AND @Link is not null)
	OR ([Language] = @Language AND @Language is not null)
	OR ([IsDisabled] = @IsDisabled AND @IsDisabled is not null)
	OR ([IsRemoved] = @IsRemoved AND @IsRemoved is not null)
	OR ([IsProduct] = @IsProduct AND @IsProduct is not null)
	OR ([DateCreate] = @DateCreate AND @DateCreate is not null)
	OR ([UserCreate] = @UserCreate AND @UserCreate is not null)
	OR ([DateModify] = @DateModify AND @DateModify is not null)
	OR ([UserModify] = @UserModify AND @UserModify is not null)
	SELECT @@ROWCOUNT			
  END
				

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblUser_Get_List procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblUser_Get_List') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblUser_Get_List
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Gets all records from the tblUser table
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblUser_Get_List

AS


				
				SELECT
					[Id],
					[Username],
					[Password],
					[Firstname],
					[Lastname],
					[Phone],
					[Role],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblUser]
					
				SELECT @@ROWCOUNT
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblUser_GetPaged procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblUser_GetPaged') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblUser_GetPaged
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Gets records from the tblUser table passing page index and page count parameters
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblUser_GetPaged
(

	@WhereClause varchar (2000)  ,

	@OrderBy varchar (2000)  ,

	@PageIndex int   ,

	@PageSize int   
)
AS


				
				BEGIN
				DECLARE @PageLowerBound int
				DECLARE @PageUpperBound int
				
				-- Set the page bounds
				SET @PageLowerBound = @PageSize * @PageIndex
				SET @PageUpperBound = @PageLowerBound + @PageSize

				-- Create a temp table to store the select results
				CREATE TABLE #PageIndex
				(
				    [IndexId] int IDENTITY (1, 1) NOT NULL,
				    [Id] bigint 
				)
				
				-- Insert into the temp table
				DECLARE @SQL AS nvarchar(4000)
				SET @SQL = 'INSERT INTO #PageIndex ([Id])'
				SET @SQL = @SQL + ' SELECT'
				IF @PageSize > 0
				BEGIN
					SET @SQL = @SQL + ' TOP ' + CONVERT(nvarchar, @PageUpperBound)
				END
				SET @SQL = @SQL + ' [Id]'
				SET @SQL = @SQL + ' FROM [dbo].[tblUser]'
				IF LEN(@WhereClause) > 0
				BEGIN
					SET @SQL = @SQL + ' WHERE ' + @WhereClause
				END
				IF LEN(@OrderBy) > 0
				BEGIN
					SET @SQL = @SQL + ' ORDER BY ' + @OrderBy
				END
				
				-- Populate the temp table
				EXEC sp_executesql @SQL

				-- Return paged results
				SELECT O.[Id], O.[Username], O.[Password], O.[Firstname], O.[Lastname], O.[Phone], O.[Role], O.[IsDisabled], O.[IsRemoved], O.[DateCreate], O.[UserCreate], O.[DateModify], O.[UserModify]
				FROM
				    [dbo].[tblUser] O,
				    #PageIndex PageIndex
				WHERE
				    PageIndex.IndexId > @PageLowerBound
					AND O.[Id] = PageIndex.[Id]
				ORDER BY
				    PageIndex.IndexId
				
				-- get row count
				SET @SQL = 'SELECT COUNT(*) AS TotalRowCount'
				SET @SQL = @SQL + ' FROM [dbo].[tblUser]'
				IF LEN(@WhereClause) > 0
				BEGIN
					SET @SQL = @SQL + ' WHERE ' + @WhereClause
				END
				EXEC sp_executesql @SQL
			
				END
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblUser_Insert procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblUser_Insert') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblUser_Insert
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Inserts a record into the tblUser table
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblUser_Insert
(

	@Id bigint    OUTPUT,

	@Username nvarchar (200)  ,

	@Password nvarchar (200)  ,

	@Firstname nvarchar (200)  ,

	@Lastname nvarchar (200)  ,

	@Phone nvarchar (200)  ,

	@Role nvarchar (200)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   ,

	@DateCreate datetime   ,

	@UserCreate nvarchar (200)  ,

	@DateModify datetime   ,

	@UserModify nvarchar (200)  
)
AS


				
				INSERT INTO [dbo].[tblUser]
					(
					[Username]
					,[Password]
					,[Firstname]
					,[Lastname]
					,[Phone]
					,[Role]
					,[IsDisabled]
					,[IsRemoved]
					,[DateCreate]
					,[UserCreate]
					,[DateModify]
					,[UserModify]
					)
				VALUES
					(
					@Username
					,@Password
					,@Firstname
					,@Lastname
					,@Phone
					,@Role
					,@IsDisabled
					,@IsRemoved
					,@DateCreate
					,@UserCreate
					,@DateModify
					,@UserModify
					)
				
				-- Get the identity value
				SET @Id = SCOPE_IDENTITY()
									
							
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblUser_Update procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblUser_Update') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblUser_Update
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Updates a record in the tblUser table
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblUser_Update
(

	@Id bigint   ,

	@Username nvarchar (200)  ,

	@Password nvarchar (200)  ,

	@Firstname nvarchar (200)  ,

	@Lastname nvarchar (200)  ,

	@Phone nvarchar (200)  ,

	@Role nvarchar (200)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   ,

	@DateCreate datetime   ,

	@UserCreate nvarchar (200)  ,

	@DateModify datetime   ,

	@UserModify nvarchar (200)  
)
AS


				
				
				-- Modify the updatable columns
				UPDATE
					[dbo].[tblUser]
				SET
					[Username] = @Username
					,[Password] = @Password
					,[Firstname] = @Firstname
					,[Lastname] = @Lastname
					,[Phone] = @Phone
					,[Role] = @Role
					,[IsDisabled] = @IsDisabled
					,[IsRemoved] = @IsRemoved
					,[DateCreate] = @DateCreate
					,[UserCreate] = @UserCreate
					,[DateModify] = @DateModify
					,[UserModify] = @UserModify
				WHERE
[Id] = @Id 
				
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblUser_Delete procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblUser_Delete') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblUser_Delete
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Deletes a record in the tblUser table
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblUser_Delete
(

	@Id bigint   
)
AS


				DELETE FROM [dbo].[tblUser] WITH (ROWLOCK) 
				WHERE
					[Id] = @Id
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblUser_GetByIdIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblUser_GetByIdIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblUser_GetByIdIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblUser table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblUser_GetByIdIsDisabled
(

	@Id bigint   ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[Username],
					[Password],
					[Firstname],
					[Lastname],
					[Phone],
					[Role],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblUser]
				WHERE
					[Id] = @Id
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblUser_GetByIdIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblUser_GetByIdIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblUser_GetByIdIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblUser table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblUser_GetByIdIsDisabledIsRemoved
(

	@Id bigint   ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[Username],
					[Password],
					[Firstname],
					[Lastname],
					[Phone],
					[Role],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblUser]
				WHERE
					[Id] = @Id
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblUser_GetByIdIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblUser_GetByIdIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblUser_GetByIdIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblUser table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblUser_GetByIdIsRemoved
(

	@Id bigint   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[Username],
					[Password],
					[Firstname],
					[Lastname],
					[Phone],
					[Role],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblUser]
				WHERE
					[Id] = @Id
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblUser_GetByRole procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblUser_GetByRole') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblUser_GetByRole
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblUser table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblUser_GetByRole
(

	@Role nvarchar (200)  
)
AS


				SELECT
					[Id],
					[Username],
					[Password],
					[Firstname],
					[Lastname],
					[Phone],
					[Role],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblUser]
				WHERE
					[Role] = @Role
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblUser_GetByRoleIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblUser_GetByRoleIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblUser_GetByRoleIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblUser table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblUser_GetByRoleIsDisabled
(

	@Role nvarchar (200)  ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[Username],
					[Password],
					[Firstname],
					[Lastname],
					[Phone],
					[Role],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblUser]
				WHERE
					[Role] = @Role
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblUser_GetByRoleIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblUser_GetByRoleIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblUser_GetByRoleIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblUser table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblUser_GetByRoleIsDisabledIsRemoved
(

	@Role nvarchar (200)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[Username],
					[Password],
					[Firstname],
					[Lastname],
					[Phone],
					[Role],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblUser]
				WHERE
					[Role] = @Role
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblUser_GetByRoleIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblUser_GetByRoleIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblUser_GetByRoleIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblUser table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblUser_GetByRoleIsRemoved
(

	@Role nvarchar (200)  ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[Username],
					[Password],
					[Firstname],
					[Lastname],
					[Phone],
					[Role],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblUser]
				WHERE
					[Role] = @Role
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblUser_GetByUsername procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblUser_GetByUsername') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblUser_GetByUsername
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblUser table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblUser_GetByUsername
(

	@Username nvarchar (200)  
)
AS


				SELECT
					[Id],
					[Username],
					[Password],
					[Firstname],
					[Lastname],
					[Phone],
					[Role],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblUser]
				WHERE
					[Username] = @Username
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblUser_GetByUsernameIsDisabledIsRemovedRole procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblUser_GetByUsernameIsDisabledIsRemovedRole') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblUser_GetByUsernameIsDisabledIsRemovedRole
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblUser table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblUser_GetByUsernameIsDisabledIsRemovedRole
(

	@Username nvarchar (200)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   ,

	@Role nvarchar (200)  
)
AS


				SELECT
					[Id],
					[Username],
					[Password],
					[Firstname],
					[Lastname],
					[Phone],
					[Role],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblUser]
				WHERE
					[Username] = @Username
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
					AND [Role] = @Role
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblUser_GetByUsernameIsDisabledRole procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblUser_GetByUsernameIsDisabledRole') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblUser_GetByUsernameIsDisabledRole
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblUser table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblUser_GetByUsernameIsDisabledRole
(

	@Username nvarchar (200)  ,

	@IsDisabled bit   ,

	@Role nvarchar (200)  
)
AS


				SELECT
					[Id],
					[Username],
					[Password],
					[Firstname],
					[Lastname],
					[Phone],
					[Role],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblUser]
				WHERE
					[Username] = @Username
					AND [IsDisabled] = @IsDisabled
					AND [Role] = @Role
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblUser_GetByUsernameIsRemovedRole procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblUser_GetByUsernameIsRemovedRole') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblUser_GetByUsernameIsRemovedRole
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblUser table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblUser_GetByUsernameIsRemovedRole
(

	@Username nvarchar (200)  ,

	@IsRemoved bit   ,

	@Role nvarchar (200)  
)
AS


				SELECT
					[Id],
					[Username],
					[Password],
					[Firstname],
					[Lastname],
					[Phone],
					[Role],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblUser]
				WHERE
					[Username] = @Username
					AND [IsRemoved] = @IsRemoved
					AND [Role] = @Role
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblUser_GetByUsernamePassword procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblUser_GetByUsernamePassword') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblUser_GetByUsernamePassword
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblUser table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblUser_GetByUsernamePassword
(

	@Username nvarchar (200)  ,

	@Password nvarchar (200)  
)
AS


				SELECT
					[Id],
					[Username],
					[Password],
					[Firstname],
					[Lastname],
					[Phone],
					[Role],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblUser]
				WHERE
					[Username] = @Username
					AND [Password] = @Password
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblUser_GetByUsernamePasswordIsDisabled procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblUser_GetByUsernamePasswordIsDisabled') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblUser_GetByUsernamePasswordIsDisabled
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblUser table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblUser_GetByUsernamePasswordIsDisabled
(

	@Username nvarchar (200)  ,

	@Password nvarchar (200)  ,

	@IsDisabled bit   
)
AS


				SELECT
					[Id],
					[Username],
					[Password],
					[Firstname],
					[Lastname],
					[Phone],
					[Role],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblUser]
				WHERE
					[Username] = @Username
					AND [Password] = @Password
					AND [IsDisabled] = @IsDisabled
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblUser_GetByUsernamePasswordIsDisabledIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblUser_GetByUsernamePasswordIsDisabledIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblUser_GetByUsernamePasswordIsDisabledIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblUser table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblUser_GetByUsernamePasswordIsDisabledIsRemoved
(

	@Username nvarchar (200)  ,

	@Password nvarchar (200)  ,

	@IsDisabled bit   ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[Username],
					[Password],
					[Firstname],
					[Lastname],
					[Phone],
					[Role],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblUser]
				WHERE
					[Username] = @Username
					AND [Password] = @Password
					AND [IsDisabled] = @IsDisabled
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblUser_GetByUsernamePasswordIsRemoved procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblUser_GetByUsernamePasswordIsRemoved') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblUser_GetByUsernamePasswordIsRemoved
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblUser table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblUser_GetByUsernamePasswordIsRemoved
(

	@Username nvarchar (200)  ,

	@Password nvarchar (200)  ,

	@IsRemoved bit   
)
AS


				SELECT
					[Id],
					[Username],
					[Password],
					[Firstname],
					[Lastname],
					[Phone],
					[Role],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblUser]
				WHERE
					[Username] = @Username
					AND [Password] = @Password
					AND [IsRemoved] = @IsRemoved
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblUser_GetByUsernameRole procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblUser_GetByUsernameRole') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblUser_GetByUsernameRole
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblUser table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblUser_GetByUsernameRole
(

	@Username nvarchar (200)  ,

	@Role nvarchar (200)  
)
AS


				SELECT
					[Id],
					[Username],
					[Password],
					[Firstname],
					[Lastname],
					[Phone],
					[Role],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblUser]
				WHERE
					[Username] = @Username
					AND [Role] = @Role
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblUser_GetById procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblUser_GetById') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblUser_GetById
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Select records from the tblUser table through an index
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblUser_GetById
(

	@Id bigint   
)
AS


				SELECT
					[Id],
					[Username],
					[Password],
					[Firstname],
					[Lastname],
					[Phone],
					[Role],
					[IsDisabled],
					[IsRemoved],
					[DateCreate],
					[UserCreate],
					[DateModify],
					[UserModify]
				FROM
					[dbo].[tblUser]
				WHERE
					[Id] = @Id
				SELECT @@ROWCOUNT
					
			

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

	

-- Drop the dbo.tblUser_Find procedure
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'dbo.tblUser_Find') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
DROP PROCEDURE dbo.tblUser_Find
GO

/*
----------------------------------------------------------------------------------------------------

-- Created By:  ()
-- Purpose: Finds records in the tblUser table passing nullable parameters
----------------------------------------------------------------------------------------------------
*/


CREATE PROCEDURE dbo.tblUser_Find
(

	@SearchUsingOR bit   = null ,

	@Id bigint   = null ,

	@Username nvarchar (200)  = null ,

	@Password nvarchar (200)  = null ,

	@Firstname nvarchar (200)  = null ,

	@Lastname nvarchar (200)  = null ,

	@Phone nvarchar (200)  = null ,

	@Role nvarchar (200)  = null ,

	@IsDisabled bit   = null ,

	@IsRemoved bit   = null ,

	@DateCreate datetime   = null ,

	@UserCreate nvarchar (200)  = null ,

	@DateModify datetime   = null ,

	@UserModify nvarchar (200)  = null 
)
AS


				
  IF ISNULL(@SearchUsingOR, 0) <> 1
  BEGIN
    SELECT
	  [Id]
	, [Username]
	, [Password]
	, [Firstname]
	, [Lastname]
	, [Phone]
	, [Role]
	, [IsDisabled]
	, [IsRemoved]
	, [DateCreate]
	, [UserCreate]
	, [DateModify]
	, [UserModify]
    FROM
	[dbo].[tblUser]
    WHERE 
	 ([Id] = @Id OR @Id IS NULL)
	AND ([Username] = @Username OR @Username IS NULL)
	AND ([Password] = @Password OR @Password IS NULL)
	AND ([Firstname] = @Firstname OR @Firstname IS NULL)
	AND ([Lastname] = @Lastname OR @Lastname IS NULL)
	AND ([Phone] = @Phone OR @Phone IS NULL)
	AND ([Role] = @Role OR @Role IS NULL)
	AND ([IsDisabled] = @IsDisabled OR @IsDisabled IS NULL)
	AND ([IsRemoved] = @IsRemoved OR @IsRemoved IS NULL)
	AND ([DateCreate] = @DateCreate OR @DateCreate IS NULL)
	AND ([UserCreate] = @UserCreate OR @UserCreate IS NULL)
	AND ([DateModify] = @DateModify OR @DateModify IS NULL)
	AND ([UserModify] = @UserModify OR @UserModify IS NULL)
						
  END
  ELSE
  BEGIN
    SELECT
	  [Id]
	, [Username]
	, [Password]
	, [Firstname]
	, [Lastname]
	, [Phone]
	, [Role]
	, [IsDisabled]
	, [IsRemoved]
	, [DateCreate]
	, [UserCreate]
	, [DateModify]
	, [UserModify]
    FROM
	[dbo].[tblUser]
    WHERE 
	 ([Id] = @Id AND @Id is not null)
	OR ([Username] = @Username AND @Username is not null)
	OR ([Password] = @Password AND @Password is not null)
	OR ([Firstname] = @Firstname AND @Firstname is not null)
	OR ([Lastname] = @Lastname AND @Lastname is not null)
	OR ([Phone] = @Phone AND @Phone is not null)
	OR ([Role] = @Role AND @Role is not null)
	OR ([IsDisabled] = @IsDisabled AND @IsDisabled is not null)
	OR ([IsRemoved] = @IsRemoved AND @IsRemoved is not null)
	OR ([DateCreate] = @DateCreate AND @DateCreate is not null)
	OR ([UserCreate] = @UserCreate AND @UserCreate is not null)
	OR ([DateModify] = @DateModify AND @DateModify is not null)
	OR ([UserModify] = @UserModify AND @UserModify is not null)
	SELECT @@ROWCOUNT			
  END
				

GO
SET QUOTED_IDENTIFIER ON 
GO
SET NOCOUNT ON
GO
SET ANSI_NULLS OFF 
GO

